package org.charles.zhifou.model.dto.user;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import lombok.Data;
import org.charles.zhifou.common.enums.CodeToEnumDeserializer;
import org.charles.zhifou.enums.SqlSortOrderEnum;
import org.charles.zhifou.enums.UserRoleEnum;

import java.io.Serial;
import java.io.Serializable;

/**
 * 用户查询请求
 *
 * @author Charles
 * @version 1.0
 */
@Data
public class UserQueryRequest implements Serializable {
    @Schema(description = "id")
    @Min(value = 1, message = "id 必须大于 0")
    private Long id;

    @Schema(description = "用户账号")
    private String userAccount;

    @Schema(description = "开放平台id")
    private String unionId;

    @Schema(description = "公众号openId")
    private String mpOpenId;

    @Schema(description = "用户昵称")
    private String userName;

    @Schema(description = "简介")
    private String userProfile;

    @Schema(description = "用户角色: 0-普通用户, 1-管理员, 2-被封号")
    @JsonDeserialize(using = CodeToEnumDeserializer.class)
    private UserRoleEnum userRole;

    @Schema(description = "当前页号")
    @Min(value = 1, message = "当前页号必须大于 0")
    private int current = 1;

    @Schema(description = "页面大小")
    @Min(value = 1, message = "页面大小必须大于 0")
    private int pageSize = 10;

    @Schema(description = "排序字段")
    private String sortField;

    @Schema(description = "排序顺序 (默认升序)")
    @JsonDeserialize(using = CodeToEnumDeserializer.class)
    private SqlSortOrderEnum sortOrder = SqlSortOrderEnum.ASC;

    @Serial
    private static final long serialVersionUID = 1L;
}